<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link type="text/css" rel="stylesheet" href="main.css">
    <!--jquery -->
	<script type="text/javascript" src="../js/jquery/jquery-2.0.3.min.js" ></script>
	
	<script type="text/javascript" src="../js/share.js"></script>
		
	<script type="text/javascript">
	var itemno = "";
	var applyid = "";
	var nodeno = "";
	var orgcode = "";
	var nextnodecode1 = "";
	var selectID = "userlist";
	var applyno = "";

	$(function(){
		applyno = getUrlParam("applyno");
		bindApply(applyno);
	})


	function bindApply(applyno){
		$.ajax({ 
			url: basePath() + 'business/getapplyinfo.do',
			data: {"applyno": applyno},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonApply = data.datas;
		    		
		    		bindApplyForm(jsonApply);
		    		
		    		//绑定业务资料
		    		bindBusinessForm(jsonApply['applyid'], jsonApply['itemno']);

//		    		//绑定附件材料
		    		bindMaterialListForm(jsonApply['applyid']);	    
		    	}
	      	}
		});
	}

	function bindApplyForm(jsonApply){
		for(var d in jsonApply){//遍历json对象的每个key/value对,p为key
			if(d == 'applytime' || d == 'syscreated'){
				$('#' + d).html(formatDate(jsonApply[d], 'yyyy年mm月dd日'));
			} else{
				$('#' + d).html(jsonApply[d] == '' ? '/' : jsonApply[d]);
			}
		}
	}

	function bindBusinessForm(applyid, itemno){

		$.ajax({ 
			url: basePath() + 'business/getbusinessinfo.do',
			data: {"applyid": applyid, "itemno": itemno},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonBusiness = data.datas;
					for(var d in jsonBusiness){	//遍历json对象的每个key/value对,d为key
						if(d == 'yachtclubname'){
							$('#yachtclubname1').html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
							$('#' + d).html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
						} else if(d == 'syscreated'){
							$('#' + d).html(formatDate(jsonBusiness[d], 'yyyy年mm月dd日'));
						} else if(d == 'businesstype'){
							if(jsonBusiness[d] == '01'){
								$('#businesstype1').css('display','');
								$('#businesstype2').css('display','none');
								$('#businesstype3').css('display','none');
								$('.change').hide();
							} else if(jsonBusiness[d] == '02'){
								$('#businesstype1').css('display','none');
								$('#businesstype2').css('display','');
								$('#businesstype3').css('display','none');
								$('.change').show();
							} else {
								$('#businesstype1').css('display','none');
								$('#businesstype2').css('display','none');
								$('#businesstype3').css('display','');
								$('.change').hide();
							}
						} else {
			    			$('#' + d).html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
						}
						
		    		}
		    	}
	      	}
		});
		$.ajax({ 
			url: basePath() + 'business/getshipinfo.do?applyid='+applyid,
			dataType: "json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonDevice = data.datas;
					for(var i = 0; i < jsonDevice.length; i++){
						$("#shipname").html(jsonDevice[i]['shipname']);
					}
		    	}
	      	}
		});
	}

	function bindMaterialListForm(applyid){

		$.ajax({ 
			url: basePath() + 'business/getmaterialinfo.do',
			data: {"applyid": applyid},
			dataType: "json",
	        contentType: "application/json",
			success: function(data){
		    	if(data.result == 1){
		    		var jsonMaterial = data.datas;

					var k = 1;
					for(var i = 0; i < jsonMaterial.length; i++){
						var materialname = jsonMaterial[i]['materialname'];
						
						var fileid=jsonMaterial[i]['fileid']
						if('' != fileid){
							var materialnameHmtl = k + '、' + materialname + '<br />';
							$('#material').append(materialnameHmtl);
							k++;
						}
					}
		    	}
	      	}
		});
	}

	</script>
    <style>
        table{
	        border-style: solid;
	        border-width: 1px;
	        border-color: black;
	        border-collapse: collapse;
        }
        .td-1{
		    text-align:center;
		    width:150px;
		    height:120px;
		    font-size: 16px;
			font-weight: 800;
		}
        .td-2{
		    text-align:center;
		    width:300px;
		    height:40px;
		    font-size: 16px;
		}
        .td-3{
		    text-align:center;
		    width:150px;
		    height:80px;
		    font-size: 16px;
		    font-weight: 800;
		}
        .td-4{
		    text-align:center;
		    width:150px;
		    height:300px;
		    font-size: 16px;
		    font-weight: 800;
		}
		.td-5{
			text-align:center;
			width:150px;
			height:150px;
			font-size: 16px;
			font-weight: 800;
		}
    </style>
    <title>游艇俱乐部备案申请书</title>
</head>
<body>
<table border="1"  align="center" cellspacing="0" cellpadding="0">
	<tr>
		<td colspan="3">
			<h1>游艇俱乐部备案申请书</h1>
        	<p style="font-size: 16px;font-family: 'Adobe 宋体 Std L';margin-top: 10px;margin-left: 5px" ><span id="orgname" >上海海事局</span>：</p>
        	<div style="text-indent:2em;font-size: 16px;font-family: 'Adobe 宋体 Std L';margin-left: 5px">
	        	<span>根据《游艇安全管理规定》，线申请下述游艇俱乐部备案（<span id="businesstype1" style="display: none">&radic;</span>）1、登记/（<span id="businesstype2" style="display: none">&radic;</span>）2、变更/（<span id="businesstype3" style="display: none">&radic;</span>）3、年审</span>
        	</div>
        	<p style="font-size: 16px;font-family: 'Adobe 宋体 Std L';margin-top: 10px;margin-left: 5px" >游艇俱乐部名称 <u id="yachtclubname1">上海××游艇有限公司</u>（盖章）法定代表人 <u id="corporation">吴××</u>（签字）</p>
        	<p id="syscreated" style="font-size: 16px;text-align: right;margin-right: 5px;">2018年06月25日</p>
        </td>
	</tr>
    <tr>
        <td class="td-1" rowspan="3">游艇俱乐部资料</td>
        <td class="td-2" colspan="2" style="text-align: left;">
        	&nbsp;名称：<span id="yachtclubname" style=" margin-left: 5px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-2" colspan="2" style="text-align: left;">
        	&nbsp;住所地：<span id="domicile" style=" margin-left: 5px;"></span>     	
        </td>
    </tr>
    <tr>
        <td class="td-2" colspan="2" style="text-align: left;">
        	&nbsp;经营地址：<span id="operateaddress" style=" margin-left: 5px;"></span>
        </td>
    </tr>
    <tr>
        <td class="td-3" rowspan="2">经办人</td>
        <td class="td-2" style="text-align: left;">
        	&nbsp;姓名：<span id="agentperson" style=" margin-left: 5px;"></span>  
        </td>
        <td class="td-2" style="text-align: left;">
        	&nbsp;身份：<span id="agentidcard" style=" margin-left: 5px;"></span>  
        </td>
    </tr>
    <tr>
         <td class="td-2" style="text-align: left;">
        	&nbsp;电话：<span id="agentphone" style=" margin-left: 5px;"></span>  
        </td>
        <td class="td-2" style="text-align: left;">
        	<span id="shipname" style=" margin-left: 5px;"></span>  
        </td>
    </tr>
    <tr>
        <td class="td-3" rowspan="2">紧急联系人</td>
        <td class="td-2" style="text-align: left;">
        	&nbsp;姓名：<span id="contactperson" style=" margin-left: 5px;"></span>  
        </td>
        <td class="td-2" style="text-align: left;">
        	&nbsp;身份：<span id="contactidcard" style=" margin-left: 5px;"></span>  
        </td>
    </tr>
    <tr>
         <td class="td-2" style="text-align: left;">
        	&nbsp;地址：<span id="contactaddress" style=" margin-left: 5px;"></span>  
        </td>
         <td class="td-2" style="text-align: left;">
        	&nbsp;电话：<span id="contactphone" style=" margin-left: 5px;"></span>  
        </td>
    </tr>
	<tr>
		<td class="td-3">游艇停泊水域</td>
		<td class="td-2" colspan="2" style="text-align: left;">
			<span id="berthwaters" style=" margin-left: 5px;"></span>  
		</td>
	</tr>
	<tr class="change">
		<td class="td-1" rowspan="3">变更</td>
		<td class="td-2" colspan="2" style="text-align: left;">
			&nbsp;变更事项：<span id="alteration" style=" margin-left: 5px;"></span>  
		</td>
	</tr>
	<tr class="change">
		<td class="td-2" colspan="2" rowspan="2" style="text-align: left;">
			&nbsp;变更事由：<span id="alterreason" style=" margin-left: 5px;"></span>  
		</td>
	</tr>
	<tr>
	</tr>
     <tr>
        <td class="td-4">附送材料</td>
        <td class="td-7" colspan="2" style="text-align: left;"><p id="material" style=" margin-left: 10px;"></p></td>
    </tr>
    <tr>
        <td class="td-5">备注</td>
        <td class="td-7" colspan="2" style="text-align: left;"><p id="mark" style=" margin-left: 10px;"></p></td>
    </tr>
</table>
</body>
</html>